package com.wkck.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wkck.domain.RegisterUser;
import com.wkck.mapper.RegisterUserMapper;
import com.wkck.service.RegisterUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class RegisterUserServiceImpl extends ServiceImpl<RegisterUserMapper, RegisterUser> implements RegisterUserService {

    @Resource
    private RegisterUserMapper registerUserMapper;

    /**
     * 判断该用户名用户是否存在实现
     * @param username
     * @return
     */

    @Override
    public boolean existUser(String username) {
        return registerUserMapper.existUser(username) != null;
    }

    /**
     * 判断用户名与手机号是否匹配
     * @param registerUser
     * @return
     */

    @Override
    public boolean usernameMatchesPhoneNumber(RegisterUser registerUser) {
        return registerUserMapper.usernameMatchesPhoneNumber(registerUser) != null;
    }

    /**
     * 根据用户名修改密码
     * @param registerUser
     * @return
     */

    @Override
    public boolean updateUser(RegisterUser registerUser) {
        return registerUserMapper.updateUser(registerUser) > 0;
    }
}
